#ifndef __BSP_PWM_H
#define __BSP_PWM_H

#if __cplusplus
extern "C"
{
#endif

#include "bsp_Inc.h"

#if __cplusplus
}
#endif

#if __cplusplus

class bsp_Pwm
{
private:
    BSP_TIM_Handle_t *TIM; // 定时器句柄
    uint32_t Channel;      // 通道
    uint32_t Prescaler;    // 预分频系数
    uint32_t Period;       // 计数值
    uint32_t Compare;      // 占空比

public:

    bsp_Pwm(BSP_TIM_Handle_t *htim, uint32_t channel, uint32_t prescaler, uint32_t period)
    {
        TIM = htim;
        Channel = channel;
        Prescaler = prescaler;
        Period = period;
    }
    ~bsp_Pwm()
    {
    }

    void init();
    void setCompare(uint32_t compare);
};

#if DEMO_PWM
extern bsp_Pwm demoPwm;
#endif

#endif

#endif
